package com.warmheart.core.enums;

import javax.validation.constraints.NotNull;

/**
 * 
 * @ClassName: WhEnum
 * @Description: 响应枚举类接口，可扩展不同类型响应码枚举
 * @author ZhangJianyang
 * @date 2025-06-16 09:37:02
 *
 * @param <K>
 */
public interface WhEnum<K> {

    /**
     * 
     * @Title: getValue
     * @Description: 枚举值
     * @author ZhangJianyang
     * @return
     */
    public K getValue();

    /**
     * 
     * @Title: getDesc
     * @Description: 枚举描述
     * @author ZhangJianyang
     * @return
     */
    public String getDesc();

    /**
     * 
     * @Title: fromCode
     * @Description: 根据枚举值获取枚举
     * @author ZhangJianyang
     * @param code
     * @return
     */
    public WhEnum<K> fromCode(K code);

    /**
     * 
     * @Title: fromCode
     * @Description: 根据枚举值获取枚举，若找不到则返回默认枚举
     * @author ZhangJianyang
     * @param code
     * @param whEnums
     * @return
     */
    public WhEnum<K> fromCode(K code, @NotNull WhEnum<K> whEnums);
}
